EN FR
EN FR


Section: New Results

The OCaml language and system

The OCaml system

Participants : Damien Doligez, Armaël Guéneau, Xavier Leroy, Luc Maranget, David Allsop [University of Cambridge] , Florian Angeletti, Frédéric Bour [Facebook] , Stephen Dolan [University of Cambridge] , Alain Frisch [Lexifi] , Jacques Garrigue [University of Nagoya] , Sébastien Hinderer, Nicolás Ojeda Bär [Lexifi] , Thomas Refis [Jane Street] , Gabriel Scherer [team Parsifal] , Mark Shinwell [Jane Street] , Leo White [Jane Street] , Jeremy Yallop [University of Cambridge] .

This year, we released three versions of the OCaml system: versions 4.06.1 and 4.07.1 are minor releases that fix 7 and 8 issues, respectively; version 4.07.0 is a major release that introduces many improvements in usability and performance, and fixes about 40 issues. The main novelties are:

  • The standard library modules were reorganized to appear as sub-modules of a new Stdlib module. The purpose of this reorganization is to facilitate the addition of new standard library modules while minimize risks of conflicts with user modules of the same name.

  • Modules Float (floating-point operations) and Seq (sequences) were added to the standard library, taking advantage of the new organization mentioned above.

  • Since 4.01, it has been possible to select a variant constructor or record field from a sub-module that is not opened in the current scope, if type information is available at the point of use. This now also works for GADT constructors.

  • The GC now handles the accumulation of custom blocks in the minor heap better. This solves some memory-usage issues observed in code which allocates a large amount of small custom blocks, typically small bigarrays.

Package management infrastructure

Participant : Damien Doligez.

This year, Damien Doligez has worked on the opamcheck tool, which is designed to check the compatibility of different versions of OCaml on the whole code base of opam, OCaml's package manager. As a by-product of this work, he has proposed numerous fixes to the opam package repository and to its dependency graph.

Work on the compiler's test suite and build system

Participant : Sébastien Hinderer.

In 2018, Sébastien Hinderer has worked on the OCaml compiler's test suite. More precisely, he has finished porting over 800 tests in the compiler's test suite so that they can be run by the tool ocamltest , developed by Sébastien earlier. To achieve this, it has been necessary to extend both ocamltest and the domain-specific language that is used to describe how tests should be executed.

In addition, Sébastien has fixed and properly documented the procedure that is used to bootstrap the OCaml compiler. Being able to compile the compiler using itself is an important feature: it is crucial, for instance, when the compiler is released. In addition to fixing the bootstrap procedure, Sébastien has introduced a way to test this procedure through continuous integration, which guarantees that it will not be broken again in the future.

Finally, Sébastien has continued to improve and refactor the compiler's build system, and, most importantly, has replaced the hand-written configuration script by an autoconf -generated one, which will be part of the upcoming 4.08 release of OCaml. This represents an important step towards the ability to produce cross-compilers for OCaml, which has been a long-standing issue for the whole OCaml community.

Optimizing OCaml for satisfiability problems

Participants : Sylvain Conchon [LRI, Univ. Paris-Saclay] , Albin Coquereau [ENSTA-ParisTech] , Mohamed Iguernlala [OCamlPro] , Fabrice Le fessant [OCamlPro] , Michel Mauny.

This work aims at improving the performance of the Alt-Ergo SMT solver, which is implemented in OCaml. For safety reasons, and to ease reasoning about its algorithms, the implementation of Alt-Ergo uses a functional programming style and persistent data structures, which are sometimes less efficient than imperative style and mutable data. Moreover, some efficient algorithms, such as CDCL SAT solvers, are naturally expressed in an imperative style.

Following our previous work on optimizing Alt-Ergo's built-in SAT solver, some efforts were needed to enable the comparison of our solver with other SMT solvers. We developed an OCaml library for parsing and type-checking SMT-LIB2. Since Alt-Ergo natively uses a polymorphic typing discipline, and since the community needs such advanced features, we proposed an extension of the SMT-LIB2 syntax where functions may be polymorphic.

The resulting new version of Alt-Ergo was presented at the 2018 SMT Workshop in Oxford  [33]. Comparisons of Alt-Ergo with other SMT solvers, mainly developed in C++, took place during the competition that is associated with the workshop. They showed that Alt-Ergo's performance is similar to that of its competitors.

Albin Coquereau's Ph.D. defense is planned for Spring 2019.

Improvements in Menhir

Participant : François Pottier.

In 2018, the OCaml parser of the OCaml compiler was migrated from ocamlyacc to Menhir, at last. François Pottier took this opportunity to partially clean up the parser, reducing redundancy by taking advantage of Menhir's features. In the future, we hope to continue to work on the OCaml parser by improving the quality of its syntax error messages.

This cleanup work was also an occasion to revisit Menhir's grammar description language: François Pottier designed and implemented a new input syntax for Menhir, which seems slightly more powerful and elegant than the previous syntax.